package org.example.springboot.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.springboot.entities.Users;
import org.example.springboot.mapper.UserMapper;
import org.example.springboot.request.UserLoginRequest;
import org.springframework.stereotype.Service;

@Service
public class UserService extends ServiceImpl<UserMapper, Users> {
  public boolean doLogin(UserLoginRequest user) {
    return baseMapper.exists(new LambdaQueryWrapper<Users>()
        .eq(Users::getUsername, user.getUsername())
        .eq(Users::getPasswordHash, user.getPassword()));
  }
}
